﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CFSystem.JXC.BLL;

namespace CFSystem.JXC.BasisInfo
{
    public partial class FrmEditDialog_PrdCgy : Form
    {
        private string _catergory = string.Empty;
        public string Catergory
        {
            set { _catergory = value; }
            get { return _catergory; }
        }

        private string _belongsTo = string.Empty;
        public string BelongsTo
        {
            set { _belongsTo = value; }
            get { return _belongsTo; }
        }

        public bool _isCancelled = false;

        public bool IsCancelled
        {
            set { _isCancelled = value; }
            get { return _isCancelled; }
        }
        /// <summary>
        /// 
        /// </summary>
        public FrmEditDialog_PrdCgy()
        {
            InitializeComponent();
            LoadBlongsToList();
        }
        /// <summary>
        /// 
        /// </summary>
        public void LoadBlongsToList()
        {
            ProdCatergory PC = new ProdCatergory(); //BLL calling.
            IList<string> lst = PC.GetAllCatergoryList();

            cmbBlongsTo.Items.Clear();

            cmbBlongsTo.Items.Add("所有类别");

            foreach (string item in lst)
            {
                cmbBlongsTo.Items.Add(item);
            }

            cmbBlongsTo.Text = "所有类别";
            cmbBlongsTo.DropDownStyle = ComboBoxStyle.DropDownList;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            this.Catergory = txtCatergory.Text.ToString();
            this.BelongsTo = cmbBlongsTo.Text.ToString();

            txtCatergory.Text = string.Empty;
            cmbBlongsTo.Text = string.Empty;
            this.Hide();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.IsCancelled = true;
            this.Hide();
        }
    }
}
